package com.szzg10.thinking.chapter11;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.szzg10.thinking.chapter18.Person;

public class MapOfList {

	public static Map<Person, List<? extends Pet>> petPeople = new HashMap<Person, List<? extends Pet>>();
	
	static {
		petPeople.put(new Person("Dawn", "Zhang"), Arrays.asList(new Cymric(), new Mutt()));
		petPeople.put(new Person("Kate", "Li"), Arrays.asList(new Cat(), new Cat(), new Dog()));
		petPeople.put(new Person("Marilyn", "Huang"), Arrays.asList(new Pug(), new Cat(), new Cat()));
		petPeople.put(new Person("Luke", "Chen"),  Arrays.asList(new Rat(), new Rat()));
		petPeople.put(new Person("Issac", "Jin"), Arrays.asList(new Rat()));
	}
	
	public static void main(String[] args) {
		System.out.println("People: " + petPeople.keySet());
		System.out.println();
		
		System.out.println("Pets: " + petPeople.values());
		System.out.println();
		
		for(Person person: petPeople.keySet()) {
			System.out.print(person.getFirst() + " has: ");
			for(Pet pet: petPeople.get(person)) {
				System.out.print(pet + " ");
			}
			
			System.out.println();
		}
	}
}
